package cn.tpshion.redismq.config;

import cn.tpshion.redismq.common.BaseConstant;
import cn.tpshion.redismq.interceptor.SaTokenInterceptor;
import jakarta.annotation.Resource;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

    @Resource
    private SaTokenInterceptor saTokenInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(saTokenInterceptor).addPathPatterns("/**")
            .excludePathPatterns(BaseConstant.EXCLUDE_PATH_PATTERNS);
    }

}
